#include "libGeoutils/tool/color_manager.h"

geo::tool::ColorMapperMgr::ColorMapperMgr()
{
}

geo::tool::ColorMapperMgr::~ColorMapperMgr()
{
}

void geo::tool::ColorMapperMgr::registerColorMapper(const std::string& name, ColorMapper::sptr colorMapper)
{
	if (!name.empty() && colorMapper) {
		mColorMappers[name][colorMapper->getNumber()] = colorMapper;
	}
}

geo::tool::ColorMapper::sptr geo::tool::ColorMapperMgr::getColorMapper(const std::string& name, int number)
{
	if (mColorMappers.count(name)) {
		auto& number_map = mColorMappers.at(name);
		if (number_map.count(number)) {
			return number_map.at(number);
		}
	}
	return nullptr;
}
